﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Graphics;

namespace PROJECT_BOMBER.BLL
{
    class PauseState : GameState
    {
        internal Texture2D img;

        bool pushPause;

        public override void Initialize()
        {
           /* PauseText = "Pause, Appuyez sur R pour reprendre la partie";
            PauseTextPosition = new Vector2(300, 300);*/
            pushPause = true;

            img = Globals.Content.Load<Texture2D>("pause");
        }

        public override void Update(float deltatime)
        {
            KeyboardState ks = Keyboard.GetState();
            if (ks.IsKeyDown(Keys.P) && !pushPause)
            {
                Globals.GameStateStack.Continue();
                pushPause = true;
            }
            else if(ks.IsKeyUp(Keys.P))
            {
                pushPause = false;
            }
        }

        public override void Draw()
        {
            Globals.GDM.GraphicsDevice.Clear(Color.Black);

            Globals.SpriteBatch.Begin();

            Globals.SpriteBatch.Draw(img, new Vector2((Globals.GDM.PreferredBackBufferWidth - 972) / 2, (Globals.GDM.PreferredBackBufferHeight - 685) / 2), Color.White);

            //Globals.SpriteBatch.DrawString(Globals.ArialFont, PauseText, PauseTextPosition, Color.Lavender);

            Globals.SpriteBatch.End();
        }

        //private String PauseText = null;
        private Vector2 PauseTextPosition = Vector2.Zero;


        public override void Load()
        {
        }

        public override void Unload()
        {
        }
    }
}
